package com.dasberg.gwt.dispatch;

import com.dasberg.gwt.command.Action;
import com.dasberg.gwt.command.Result;

import java.util.Map;

/**
 * A Dispatcher processes Actions and returns Results.
 * @author mischa
 */
public interface Dispatcher {
    /**
     * Gets the action Handlers.
     * @return handlers The Handlers.
     */
    Map<Class<Action>, Handler<Action>> getHandlers();

    /**
     * Processes the given Action and returns the corresponding Result.
     * @param action The Action.
     * @return result The Result.
     */
    Result process(Action action) throws HandlerException, ActionException;
}
